<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="jt.classic.system.group.IGroup"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>	
<%@ page import="org.limp.mine.DateTrimmer"%>
<%@ page import="jt.classic.system.wordbook.XWordbook" %>
<% 
    String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[])request.getAttribute("result");	
	Label label = (Label)result[1];
	Controller controller = (Controller)result[2];	
	String pageNO = (String)result[3];
	List resultList = (List) result[0];
	
	Map query = (Map)request.getAttribute("query");
    
    XWordbook wb = (XWordbook)request.getAttribute("wb");
	
	String qname = (String)query.get("qname");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>信息列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../head.jsp"></jsp:include>
<script language="javascript">
  var chk = false;
  function checkall(thizz){
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox"){
        chks[i].checked = !chk;
      }
    }
    
    chk = !chk;
  }
  
  /*function handleDelete(){
    var rnt = false;
    var ids = "";
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox" && chks[i].checked){
        rnt = true;
        ids += chks[i].value + ",";
      }
    }
    
    if(!rnt){
      alert("请选择要删除信息");
    }else if(confirm("删除信息")){
      createHidden("ids",ids.substring(0,ids.length - 1));
      document.form1.action = "<%=context%>/app/info.do?method=delete";
      document.form1.submit();
    }
  }*/
  
  function handleQuery(){
      document.form1.action = context + "/app/info.do?method=issuebytype&typeid=<%=wb!=null?wb.getID():""%>";
      document.form1.submit();
  }
  
  function handleReresh(){
      window.location.href = context + "/app/info.do?method=issuebytype&typeid=<%=wb!=null?wb.getID():""%>&pageNO=<%=pageNO%>";
  }
  
  function handleView(id){
      var url = context + "/app/info.do?method=previewinfo&id=" + id + "&issue=type"; 
      top.xwin(this,url,true,"",200,300);
  }
  
  function handleEdit(id){
      window.location.href = context + "/app/info.do?method=editinfo&id=" + id; 
  }
  
  function handleDelete(id){
      if(confirm("确定删除")){
         window.location.href = context + "/app/info.do?method=deleteinfo&ifid=" + id;
      }
  }
  
  function handleSelect(s){
      var url = context + "/app/info.do?method=directorytree&select=true";
      dialog(url,true,"选择所属栏目",300,350);
  }
  
  function responseResult(ids,names,types){
      document.form1.qdirec.value = names;
      
      closeDialog();
  }
</script>
<body>
<form name="form1" method="post" action="">
<input type="hidden" name="pageNO" value="<%=pageNO%>">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left"> 
    	<img src="<%=context%>/app/images/arrow.gif" width="16" height="16">公共事务 ->> <%=wb!=null?wb.getName():""%>
    </td>
  </tr>  
</table>
<br> 
<table class="tab" border="0" width="98%" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="8" align="right">
       标题
       <input type="text" name="qname" value="<%=qname%>">
       <input type="button" class="button0" value=" 查 询 " onclick="javascript:handleQuery();">
       <!--<input type="button" class="button0" value=" 删 除 " onclick="javascript:handleDelete();">-->
       <input type="button" class="button0" value=" 刷 新 " onclick="javascript:handleReresh();">
    </td>
  </tr>
  <tr>
    <td colspan="8"></td>
  </tr>
  <tr class="tr0" bgcolor="#A7CADE"> 
    <td class="td0" background="<%=context%>/app/images/bg_lm.jpg" title="全部选择/取消选择" onclick="javascript:checkall();" width="10" align="center">&nbsp;</td>
    <td class="td0" background="<%=context%>/app/images/bg_lm.jpg" width="45%" align="center">&nbsp;标题</td>
    <td class="td0" background="<%=context%>/app/images/bg_lm.jpg" width="10%" align="center">&nbsp;信息类别</td>
    <td class="td0" background="<%=context%>/app/images/bg_lm.jpg" width="10%" align="center">&nbsp;所属栏目</td>
    <td class="td0" background="<%=context%>/app/images/bg_lm.jpg" width="20%" align="center">&nbsp;发布时间</td>
    <td class="td0" background="<%=context%>/app/images/bg_lm.jpg" width="10%" align="center">&nbsp;发布人</td>
  </tr>
  <% 
    if(resultList!=null&&!resultList.isEmpty()){
       for(int i=0;i<resultList.size();i++){
	       Map info = (Map)resultList.get(i);
	       String number = (String)info.get("PAGINATION_NUMBER");
	       String title = (String)info.get("IF_TITLE");
	       String itname = (String)info.get("IT_NAME");
	       String idname = (String)info.get("ID_NAME");
	       String date = (String)info.get("IF_DATE");
	       String username = (String)info.get("IF_USERNAME");
	       String id = (String)info.get("IF_ID");
  %> 
  <tr onMouseOver="javascript:this.bgColor='#ffff99'" onmouseout=" javascript:this.bgColor='#F5F7F9'" bgColor="#F5F7F9"> 
    <td class="td1" align="center">
    <!--<input type="checkbox" name="chk" value="<%=id%>">--><%=number%>
    </td>
    <td class="td1" align="center">&nbsp;<a href="javascript:void(0);" onclick="javascript:handleView('<%=id%>');"><%=title%></a></td>
    <td class="td1" align="center">&nbsp;<%=itname%></td>
    <td class="td1" align="center">&nbsp;<%=idname%></td>
    <td class="td1" align="center">&nbsp;<%=DateTrimmer.getYMDHMS_LBL(date)%></td>
    <td class="td1" align="center"><%=username%></td>
  </tr>
  <%
        }
     }
  %>
</table> 
<table width="98%" class="tab-noborder" border="0" cellspacing="0" cellpadding="0">
  <tr>
   <td>
    <%=label.displayLabel()%>
   </td>
   <td align="right">
        <%=label.startLabel()%>
        <%=label.previousLabel()%>
        <%=label.nextLabel()%>
        <%=label.endLabel()%>
        <%=controller.getController().toString()%>
    </td>
  </tr>
</table>  
<%=controller.getControlScript(true)%> 
</form>
</body>
</html>	